import Vue from 'vue'
import Router from 'vue-router'
const login = () => import('../view/login.vue')
const layout = () => import('../view/layout.vue')
const index = () => import('../view/index.vue')
const menu = () => import('../view/menu/index.vue')
const role = () => import('../view/role/index.vue')

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/login',
            name: 'login',
            component: login,
            meta: {
                title: '欢迎登录'
            }
        },
        {
            path: '/index',
            name: 'layout',
            component: layout,
            children: [
                {path: '', component: index, meta: {title: '首页'}},
                {path: 'menu', component: menu, meta: {title: '菜单'}},
                {path: 'role', component: role, meta: {title: '角色'}},
            ]
        },
        {
            path: '/',
            redirect: 'index'
        }
    ]
})